package com.tao.mytestdd.datagrama;

import com.google.gson.reflect.TypeToken;

import java.io.Serializable;
import java.util.Random;

/**
 * reate by tao on{DATE}
 */
public class DataEntity<T>  implements Serializable {
    // 本机接收数据地址
    String host;
    //本机接收数据端口
    int port;
    // 会话标识
    String session;
    // 数据包编号
    int index;
    // 数据包标志
    int packageTag;
    // 会话有效时间 单位毫秒
    int sessionTime = 1;
    //消息时间戳
    long timeStamp;
    // 单包数据 分裂成udp包的数量
    int pckageCount;
    //单包数据等待时间 单位毫秒
    int packageVaildTime;
    //完整数据实体 
    T obj;
    //单包数据 bytes
    byte[] objBytes;
    //   客户端   服务端
    boolean fromServer =false;
    public static void main(String[] args) {
        Random random = new Random();
        random.nextInt(1);
    }

    public boolean isFromServer() {
        return fromServer;
    }

    public void setFromServer(boolean fromServer) {
        this.fromServer = fromServer;
    }

    public String getHost() {
        return host;
    }

    public void setHost(String host) {
        this.host = host;
    }

    public int getPort() {
        return port;
    }

    public void setPort(int port) {
        this.port = port;
    }

    public String getSession() {
        return session;
    }

    public void setSession(String session) {
        this.session = session;
    }

    public int getIndex() {
        return index;
    }

    public void setIndex(int index) {
        this.index = index;
    }

    public int getPackageTag() {
        return packageTag;
    }

    public void setPackageTag(int packageTag) {
        this.packageTag = packageTag;
    }

    public int getSessionTime() {
        return sessionTime;
    }

    public void setSessionTime(int sessionTime) {
        this.sessionTime = sessionTime;
    }

    public long getTimeStamp() {
        return timeStamp;
    }

    public void setTimeStamp(long timeStamp) {
        this.timeStamp = timeStamp;
    }

    public int getPckageCount() {
        return pckageCount;
    }

    public void setPckageCount(int pckageCount) {
        this.pckageCount = pckageCount;
    }

    public int getPackageVaildTime() {
        return packageVaildTime;
    }

    public void setPackageVaildTime(int packageVaildTime) {
        this.packageVaildTime = packageVaildTime;
    }

    public T getObj() {
        return obj;
    }

    public void setObj(T obj) {
        this.obj = obj;
    }

    public byte[] getObjBytes() {
        return objBytes;
    }

    public void setObjBytes(byte[] objBytes) {
        this.objBytes = objBytes;
    }
}
